package implementor;

import daoInterface.PaymentMethodDao;
import dbhandeling.Crude;
import dto.PaymentMethod;


public class PaymentMethodDaoImplementor extends Crude implements PaymentMethodDao
{
String className=new PaymentMethod().getClass().getName();
@Override
public void add(PaymentMethod paymentmethod) throws Exception
{
insert(paymentmethod);
}
/***********************************************************/
@Override
public void update(PaymentMethod paymentmethod) throws Exception
{
super.update(className,"paymentMethodName",paymentmethod.getpaymentMethodName()+"","autoPaymentMethodId",paymentmethod.getautoPaymentMethodId()+"");
super.update(className,"status",paymentmethod.getstatus()+"","autoPaymentMethodId",paymentmethod.getautoPaymentMethodId()+"");
}
/***********************************************************/
@Override
public void delete(PaymentMethod paymentmethod) throws Exception
{
super.delete(className,"autoPaymentMethodId",paymentmethod.getautoPaymentMethodId()+"");
}
/***********************************************************/
@Override
public PaymentMethod retrieve(String conditionField,String conditionValue) throws Exception
{
PaymentMethod paymentmethod=(PaymentMethod) super.retreive(className,conditionField,conditionValue);
return paymentmethod;
}
/***********************************************************/
@Override
public PaymentMethod[] retrieveArray(String conditionField,String conditionValue) throws Exception
{
PaymentMethod[] paymentmethod;
Object[] obj=super.retreiveArrayOnCondition(className,conditionField, conditionValue);
paymentmethod=new PaymentMethod[obj.length];
for(int i=0;i<paymentmethod.length;i++)
{
paymentmethod[i]=(PaymentMethod) obj[i];
}
return paymentmethod;
}
/***********************************************************/
@Override
public PaymentMethod[] retrieveAll() throws Exception
{
PaymentMethod[] paymentmethod;
Object[] obj=super.retreiveAll(className);
paymentmethod=new PaymentMethod[obj.length];
for(int i=0;i<paymentmethod.length;i++)
{
paymentmethod[i]=(PaymentMethod) obj[i];
}
return paymentmethod;
}
/***********************************************************/
public int getAutoGenratedKey()
{
	 int key=super.getAutoGenratedKey(className,"autoPaymentMethodId") ;
	 return key;
}
}
